
var ctx;

function setCtx(ctx){
	this.ctx = ctx;
}

//鼠标滑入一行改变背景颜色
function mouseoverOne(target) {
	$(target).children().each(function() {
		$(this).css("background", "#D3F0F1");
	});
}

//鼠标滑出一行恢复原来的背景颜色
function mouseoutOne(target) {
	$(target).children().each(function() {
		$(this).css("background", "");
	});
}

function resetpassword(id,username) {
	var newPwd = randomPwd();
	
	layer.confirm('是否要重置密码，重置后密码为' + newPwd + '?', {icon: 3, title:'提示'}, function(index){
	    //do something
		$.ajax({
			type : "POST",
			url : ctx + "/ownerinfo/reSetPassword",
			cache : false,
			dataType : 'json',
			data: {
				id : id,
				username: username,
				pwd:encrypt(newPwd,username)
			},
			success : function(result) {
				if (result.success) {
					layer.msg("操作成功",{
						icon: 1,
						time: 1000 //2秒关闭（如果不配置，默认是3秒）
					},function(){
						loadContent("/ownerinfo/ownerInfoList");
					});
				} else {
					layer.msg("操作失败",{
						icon: 2
					});
				}
			}
		});
	    layer.close(index);
	});
    
	
	
}